//package com.ztesoft.huangfu.learning.springboot.springbootssoauth2.config;
//
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
//import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
//
///**
// * Created with IntelliJ IDEA.
// * Author: huangfu.daohui
// * Date: 2018/6/21
// * Time: 18:53
// * Version: 1.0
// * Description:
// **/
//@Configuration
//@EnableWebSecurity
//public class SecurityConfiguration extends WebSecurityConfigurerAdapter
//{
//    //自定义UserDetailsService注入
//    @Autowired
//    private HengYuUserDetailsService userDetailsService;
//    //配置匹配用户时密码规则
//    @Bean
//    public PasswordEncoder passwordEncoder() {
//        return new StandardPasswordEncoder();
//    }
//    //配置全局设置
//    @Autowired
//    public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception {
//        //设置UserDetailsService以及密码规则
//        auth.userDetailsService(userDetailsService).passwordEncoder(passwordEncoder());
//    }
//    //排除/hello路径拦截
//    @Override
//    public void configure(WebSecurity web) throws Exception {
//        web.ignoring().antMatchers("/hello");
//    }
//    @Override
//    @Bean
//    public AuthenticationManager authenticationManagerBean() throws Exception {
//        return super.authenticationManagerBean();
//    }
//    //开启全局方法拦截
//    @EnableGlobalMethodSecurity(prePostEnabled = true, jsr250Enabled = true)
//    public static class GlobalSecurityConfiguration extends GlobalMethodSecurityConfiguration {
//        @Override
//        protected MethodSecurityExpressionHandler createExpressionHandler() {
//            return new OAuth2MethodSecurityExpressionHandler();
//        }
//
//    }
//}
